clc;clear;tic;

global rho gma delta1 delta2 beta T N ...
    psi_m psi_f alpha ...
    level_model level_data share_model share_data ...
    ind11 ind12 ind21 ind22 ...
    Cobb_Douglas price_reduction decomposition ...
    a_m a_f a_g a_y a_h ...
    W W_m W_f p P_c ...
    age married insample insample_data nkid X_theta phi_theta ...
    param_W_m param_W_f ...
    R T_D T_R expr_m0 expr_f0 W_m_base W_f_base

% initialize options
initialize;

%% calibration (Tables D4)
calibration=true;simulate;

%% decomposition (Table D5)
calibration=false;decomposition=true;baseline=true;simulate;
baseline=false;equal_wage=true;simulate;
equal_price=true;simulate;
equal_wage=false;equal_price=false;equal_tech=true;simulate;
equal_tech=false;equal_pref=true;simulate;

%% 30% price reduction (Table D6)
% nested CES
decomposition=false;price_reduction=true;quo=true;simulate;
quo=false;pct_reduction=30;reduce_W=true;simulate;
reduce_W=false;reduce_W_temporary=true;simulate;
reduce_W_temporary=false;reduce_W_constant_full_income=true;simulate;
reduce_W_constant_full_income=false;reduce_p=true;simulate;
reduce_p=false;reduce_P_c=true;simulate;

% Cobb-Douglas 
reduce_P_c=false;Cobb_Douglas=true;quo=true;simulate;
quo=false;pct_reduction=30;reduce_W=true;simulate;
reduce_W=false;reduce_W_temporary=true;simulate;
reduce_W_temporary=false;reduce_W_constant_full_income=true;simulate;
reduce_W_constant_full_income=false;reduce_p=true;simulate;
reduce_p=false;reduce_P_c=true;simulate;

%% generate tables
gentab;

toc;